#!/bin/bash
[% c("var/set_default_env") -%]
distdir="/var/tmp/dist/[% project %]"
mkdir -p "$distdir"
tar xzf [% c('input_files_by_name/SDK') %]
mv MacOSX10.7.sdk "$distdir/SDK"
tar xf [% c('input_files_by_name/llvm') %]
mv llvm "$distdir/clang"
tar -C $distdir -xf [% c('input_files_by_name/cctools') %]
cd $distdir/cctools/bin
ln -s ../../clang/bin/clang x86_64-apple-darwin10-clang
ln -s ../../clang/bin/clang++ x86_64-apple-darwin10-clang++
# "go link" expects to find a program called "dsymutil" exactly.
ln -sf x86_64-apple-darwin10-dsymutil dsymutil

cd "/var/tmp/dist"
[% c('tar', {
   tar_src => [ project ],
   tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
}) %]
